home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.2)
-
- '''
- /***************************************************************************
-
- \tAuthor \t\t\t:Charles B. Cosse
- \t
- \tEmail\t\t\t:ccosse@asymptopia.com
- \t\t\t\t\t
- \t\t\t\t\t
- \tCopyright\t\t:(C) 2002,2003 Asymptopia Software.
- \t
- ***************************************************************************/
- /***************************************************************************
- myutil.py
-
- ***************************************************************************/
-
- /***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. (Please note that if you use this *
- * code you must give credit by including the Author and Copyright *
- * info at the top of this file). *
- ***************************************************************************/
- '''
- import pygame
- import os
- import sys
- from pygame.locals import *
-
- try:
- for sitepkgdir in sys.path:
- if sitepkgdir[-13:] == 'site-packages':
- break
-
- except:
- pass
-
-
- def load_image(name, colorkey = None):
- fullname = os.path.join(sitepkgdir, name)
-
- try:
- image = pygame.image.load(fullname)
- except pygame.error:
- message = None
- print 'Cannot load image:', name
- raise SystemExit, message
-
- image = image.convert()
- if colorkey is not None:
- if colorkey is -1:
- colorkey = image.get_at((0, 0))
-
- image.set_colorkey(colorkey, RLEACCEL)
-
- return (image, image.get_rect())
-
-
- def load_sound(name):
-
- class NoneSound:
-
- def play(self):
- pass
-
-
- if not (pygame.mixer) or not pygame.mixer.get_init():
- return NoneSound()
-
- fullname = os.path.join(sitepkgdir, name)
-
- try:
- sound = pygame.mixer.Sound(fullname)
- except pygame.error:
- message = None
- print 'Cannot load sound:', fullname
- raise SystemExit, message
-
- return sound
-
-